<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>轮播图管理</title>
<style>
</style>
	</ui:define>
	<ui:define name="content">
		<div class='full-center-content-scroll-noheader'>
			<div class="row">
				<div class="col-md-12 full-content" style="padding-right: 3px">
					<div class="box box-success">
						<div class="box-body full-content-scroll">
							<h:form id="form">
								<p:growl id="msg" showDetail="true"></p:growl>
								<p:confirmDialog global="true" showEffect="fade"
									hideEffect="fade">
									<p:commandButton value="是" type="button"
										styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
									<p:commandButton value="否" type="button"
										styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
								</p:confirmDialog>
								<p:toolbar>
									<f:facet name="left">
										<p:commandButton value="新建" icon="ui-icon-plus" rendered="#{s:hasPermission(session,'gzgl_yddsjwh_lbtsz_xj')}" actionListener="#{bannerManagerController.preCreate}" update=":dialogForm:bannerDlg" oncomplete="PF('bannerDlg').show()"/>
										<p:commandButton value="编辑" icon="ui-icon-pencil" id="editBtn" rendered="#{s:hasPermission(session,'gzgl_yddsjwh_lbtsz_bj')}" disabled="#{bannerManagerController.current == null}" update=":dialogForm:bannerDlg" oncomplete="PF('bannerDlg').show()"/>
										<p:commandButton value="删除" icon="ui-icon-trash" id="deleteBtn" rendered="#{s:hasPermission(session,'gzgl_yddsjwh_lbtsz_sc
										')}" disabled="#{bannerManagerController.current == null}" actionListener="#{bannerManagerController.delete}" update="bannerTab msg editBtn @this">
											<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
										</p:commandButton>
										<p:commandButton value="效果预览" icon="ui-icon-circle-triangle-e" update="dialogForm:viewDialog" oncomplete="PF('viewDialog').show()" style="margin-left:10px"/>
									</f:facet>
								</p:toolbar>
								<p:dataTable id="bannerTab" widgetVar="bannerTab" var="banner" rowKey="#{banner.id}" 
									value="#{bannerManagerController.banners}" emptyMessage="无记录" selectionMode="single" style="text-align:center" >
									<p:ajax event="rowSelect" update="form:editBtn form:deleteBtn" listener="#{bannerManagerController.rowSelect}" />
									<p:column headerText="标题">
										<p:outputLabel value="#{banner.title}" />
									</p:column>
									<p:column headerText="超链接">
										<p:outputLabel value="#{banner.link}" />
									</p:column>
									<p:column headerText="图片名" width="250">
										<p:outputLabel value="#{banner.name}" />
									</p:column>
									<p:column headerText="更新时间" width="160">
										<p:outputLabel value="#{bannerManagerController.formatterDate(banner.createDate)}" />
									</p:column>
									<p:column headerText="大图" width="100">
										<p:commandButton icon="ui-icon-image" update=":dialogForm:bigImage" oncomplete="PF('bigImage').show()">
											<f:setPropertyActionListener value="#{banner}" target="#{bannerManagerController.current}"/>
										</p:commandButton>
									</p:column>
								</p:dataTable>
							</h:form>
							
							<h:form id="dialogForm">
								<p:dialog widgetVar="bannerDlg" header="选择图片" modal="true" id="bannerDlg" width="500" height="280">
									<p:toolbar>
										<f:facet name="left">
											<p:commandButton value="保存" icon="ui-icon-disk" actionListener="#{bannerManagerController.save}" update=":form:bannerTab :form:msg" oncomplete="PF('bannerDlg').hide()"/>
											<p:commandButton value="取消" icon="ui-icon-cancel" oncomplete="PF('bannerDlg').hide()"/>
										</f:facet>
									</p:toolbar>
									<p:panelGrid>
										<p:row>
										<p:column>
											<p:outputLabel value="标题"/>
										</p:column>
										<p:column colspan="2">
											<p:inputText value="#{bannerManagerController.current.title}" style="width:300px"/>
										</p:column>
										</p:row>
										<p:row>
											<p:column>
												<p:outputLabel value="链接"/>
											</p:column>
											<p:column>
												<p:inputText id="link" value="#{bannerManagerController.current.link}" style="width:300px"/>
											</p:column>
											<p:column>
												<p:commandButton style="width:60px" value="选择" oncomplete="PF('treeDialog').show()"/>
											</p:column>
										</p:row>
										<p:row>
											<p:column>
												<p:outputLabel value="图片"/>
											</p:column>
											<p:column>
												<p:inputText id="imageName" value="#{bannerManagerController.current.name}" style="width:300px">
													<p:ajax event="focus" oncomplete="PF('fileUpload').show()"/>
												</p:inputText>
											</p:column>
											<p:column>
												<p:graphicImage id="image_small" value="#{request.contextPath}/getServerImage?path=#{bannerManagerController.currentImagePath}" style="width:50px;height:50px"/>
											</p:column>
										</p:row>
										<p:row>
											<p:column>
												<p:outputLabel value="序号"/>
											</p:column>
											<p:column colspan="2">
												<p:inputText value="#{bannerManagerController.current.orderd}" style="width:300px"/>
											</p:column>
										</p:row>
									</p:panelGrid>
								</p:dialog>
								
								<p:dialog header="上传文件" widgetVar="fileUpload" modal="false" id="fileUpload" width="600" height="200">
									<p:fileUpload style="margin-top:10px" cancelLabel="取消" sizeLimit="1000000" fileLimit="3" mode="advanced"
										dragDropSupport="false" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" oncomplete="PF('fileUpload').hide()" update="imageName image_small :form:msg"
										fileUploadListener="#{bannerManagerController.handleFileUpload}" uploadLabel="上传" label="文件" />
								</p:dialog>
								<p:dialog widgetVar="bigImage" header="大图" modal="true" id="bigImage" width="600" height="500">
									<p:graphicImage cache="true" style="width:100%;height:100%;"
										value="#{request.contextPath}/getServerImage?path=#{bannerManagerController.currentImagePath}"/>
								</p:dialog>
								
								<p:dialog widgetVar="viewDialog" header="轮播图" modal="true" id="viewDialog" width="550" height="450">
									<p:galleria value="#{bannerManagerController.banners}" var="image" panelWidth="500" panelHeight="313" showCaption="false">
										<p:graphicImage value="#{request.contextPath}/getServerImage?path=#{bannerManagerController.imagePath(image.path)}" title="#{image.title}"/>
									</p:galleria>
								</p:dialog>
								
								<p:dialog widgetVar="treeDialog" id="treeDialog" header="选择地址"
									modal="true" width="350" height="500">
									<p:toolbar>
										<f:facet name="left">
											<p:commandButton value="确定"
												actionListener="#{bannerManagerController.chooseUrlNode}"
												update=":dialogForm:link" onclick="PF('treeDialog').hide()" />
										</f:facet>
									</p:toolbar>
					
									<p:tree value="#{functionManagerController.urlRoot}" var="item"
										dynamic="true" animate="true" id="urlTree" widgetVar="urlTree"
										selectionMode="single" selection="#{bannerManagerController.selectedUrlNode}">
										<p:ajax event="expand" listener="#{functionManagerController.onUrlTreeNodeExpand}"
											update="urlTree" />
										<p:treeNode type="root">
											<h:outputText value="#{item}" />
										</p:treeNode>
										<p:treeNode type="other">
											<h:outputText value="#{item}" />
										</p:treeNode>
									</p:tree>
					
								</p:dialog>
							</h:form>
						</div>
						<div class="box-footer"></div>
					</div>
				</div>
			</div>
			<div id="pop" class="modal">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-label="Close">
								<span aria-hidden="false">x</span>
							</button>
							<h4 id="popTitle" class="modal-title"></h4>
						</div>
						<div class="modal-body" style="height: 500px">
							<div id="popBody" class="col-sm-12">
								<div id="popChart" style="height: 450px"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</ui:define>

	<ui:define name="contentend">
	</ui:define>
</ui:composition>
